Skip to content

Add SROS show port description multiline support#2306

Merged
matt852 merged 3 commits into
networktocode:masterfrom
mjbear:alc_sros_sh_port_desc_issue2305
Jun 29, 2026
Merged

Add SROS show port description multiline support#2306
matt852 merged 3 commits into
networktocode:masterfrom
mjbear:alc_sros_sh_port_desc_issue2305

Conversation

@mjbear

@mjbear mjbear commented Apr 9, 2026

Copy link
Copy Markdown
Collaborator

resolves #2305

Add/fix support for alcatel_sros multiline show port description lines.

@mjbear mjbear marked this pull request as ready for review April 23, 2026 00:37

@matt852 matt852 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recommendation: Changes Suggested

@mjbear thoughts on this agentic suggestion and how viable it is?

  • Simplify the modified header rule. The new (\s*\S*\s*\S*) group extends the match by at most two trailing tokens, so a header like Port Descriptions on Card 1 Module 2 Foo Bar would still fail to match. \s+.+ matches any trailing content and reads more clearly; tests pass locally with this change.

    In ntc_templates/templates/alcatel_sros_show_port_description.textfsm, the header rule in Start:

    -  ^Port\s+Descriptions\s+on\s\S+\s+\S+(\s*\S*\s*\S*)\s*$$ 
    +  ^Port\s+Descriptions\s+on\s+.+$$

Thanks!

@mjbear

mjbear commented May 13, 2026

Copy link
Copy Markdown
Collaborator Author
* **Simplify the modified header rule.** The new `(\s*\S*\s*\S*)` group extends the match by at most two trailing tokens,

This was designed to match the "Port Cross Connect 1" text and still be backwards compatible with two-word port names.

Port Descriptions on Port Cross Connect 1

so a header like Port Descriptions on Card 1 Module 2 Foo Bar would still fail to match. \s+.+ matches any trailing content and reads more clearly; tests pass locally with this change.

There are more words in the foo bar example than we see in actual output.

Nothing wrong with some simplification. ❤️
Maybe we don't even need to anchor on the end of the line?

(So instead of the first two, just the last one in green.)

-  ^Port\s+Descriptions\s+on\s\S+\s+\S+(\s*\S*\s*\S*)\s*$$ 
-  ^Port\s+Descriptions\s+on\s+.+$$
+  ^Port\s+Descriptions\s+on

Thank you for the review

@matt852

matt852 commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

I think that will work as well. Update and I'll approve.
I ran it through my AI reviewer and it confirmed, explaining why:

Thanks @mjbear — the multiline-description handling and the new fixture look great, and tests pass cleanly. One suggestion before merge:

  • Simplify the header rule. The (\s*\S*\s*\S*) group only buys two extra trailing tokens, so a longer header label would still slip through, and it's a bit hard to read. Since this rule just discards the header line (no Value is captured from it), it can match on the stable prefix instead — which is the form you proposed in the thread. I confirmed all tests still pass with it.

    In ntc_templates/templates/alcatel_sros_show_port_description.textfsm, the header rule in Start:

    -  ^Port\s+Descriptions\s+on\s\S+\s+\S+(\s*\S*\s*\S*)\s*$$ 
    +  ^Port\s+Descriptions\s+on

@mjbear

mjbear commented Jun 27, 2026

Copy link
Copy Markdown
Collaborator Author

I think that will work as well. Update and I'll approve.
I ran it through my AI reviewer and it confirmed, explaining why:

This pattern has been there since inception via PR #1912 - makes sense to adjust/simplify it.

I've updated the port description pattern in the template.

@mjbear mjbear removed the question label Jun 27, 2026
@mjbear mjbear requested a review from matt852 June 27, 2026 23:43
@matt852 matt852 merged commit 9c3c7ff into networktocode:master Jun 29, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SROS22 multi-line show port description

2 participants